package com.merak.rebot.controller;

import com.ctg.behavior.utils.ReturnUtil;
import com.merak.rebot.common.UploaderFile;
import com.merak.rebot.python.UploadFileExecutor;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author zhubocheng
 */
@RestController
@RequestMapping("/api/merak")
@CrossOrigin
public class UploadFileController {

    @Resource
    private UploadFileExecutor uploadFileExecutor;

    /**
     * 文件上传接口
     * @param uploaderFile
     * @return
     */
    @RequestMapping(value = "/uploader", method = RequestMethod.POST)
    @ResponseBody
    public ReturnUtil postUploader(UploaderFile uploaderFile){
        //文件上传
        return uploadFileExecutor.doExecutor(uploaderFile);
    }

//    /**
//     * 上传文件信息查询接口
//     * @param ctShowUpParam
//     * @return
//     */
//    @RequestMapping(value = "/file/showUploaderInfo", method = RequestMethod.POST)
//    @ResponseBody
//    public ReturnUtil showUploaderInfo(CtShowUpParam ctShowUpParam){
//        //展示上传历史信息
//        return uploadFileExecutor.showUploaderInfo(ctShowUpParam);
//    }

    /**
     * 配置文件上传接口
     * @param uploaderFile
     * @return
     */
    @RequestMapping(value = "/uploaderConfigFile", method = RequestMethod.POST)
    @ResponseBody
    public ReturnUtil uploaderConfigFile(UploaderFile uploaderFile){
        //文件上传
        return uploadFileExecutor.doConfigExecutor(uploaderFile);
    }


}
